package com.qf.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.PageInterceptor;
import com.qf.entity.NewsComment;
import com.qf.entity.NewsCommentExample;
import com.qf.entity.NewsDetail;
import com.qf.entity.NewsDetailExample;
import com.qf.mapper.NewsCommentMapper;
import com.qf.mapper.NewsDetailMapper;
import com.qf.service.NewCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 写字楼里写字间，写字间里程序员；
 * 程序人员写程序，又拿程序换酒钱。
 * 酒醒只在网上坐，酒醉还来网下眠；
 * 酒醉酒醒日复日，网上网下年复年。
 * 但愿老死电脑间，不愿鞠躬老板前；
 * 奔驰宝马贵者趣，公交自行程序员。
 * 别人笑我忒疯癫，我笑自己命太贱；
 * 不见满街漂亮妹，哪个归得程序员？
 *
 * @version v1.0
 * @authorLenovo
 * @date2021/10/7
 */
@Service
public class NewCommentServiceImpl implements NewCommentService {
    @Autowired
    private NewsCommentMapper newsCommentMapper;

    @Override
    public List<NewsComment> selectById(int id) {
        NewsCommentExample newsCommentExample =new NewsCommentExample();
        NewsCommentExample.Criteria criteria = newsCommentExample.createCriteria();
        criteria.andNewsidEqualTo("id");
        List<NewsComment> newsComments = newsCommentMapper.selectByExample(newsCommentExample);
        return newsComments;
    }

    @Override
    public void insert(NewsComment newsComment) {
        newsCommentMapper.insert(newsComment);
    }
}
